package day_1126;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class ComTest {
    public static void main(String[] args) {
        Company c = new Company();
        c.setName("大富豪土豆有限公司");
        c.setScope("火箭买卖");
        c.setAddress("合肥");
        Scanner in = new Scanner(System.in);
        int choice = 0;
        while (true) {
            System.out.println("1:查看公司信息，2：新人加入，3：开除，4：最高薪水的员工，9:退出");
            choice = in.nextInt();
            if (choice == 1) {
                c.show();
            } else if (choice == 2) {
                Staff s = new Staff();
                System.out.print("请输入工号：");
                s.setNo(in.next());
                System.out.print("请输入姓名：");
                s.setName(in.next());
                System.out.print("请输入年龄：");
                s.setAge(in.nextInt());
                System.out.print("请输入职务：");
                s.setPosition(in.next());

                System.out.print("请输入薪水：");
                s.setSalary(in.nextInt());

                boolean b = c.hire(s);
                System.out.println(b ? "入职成功" : "工号重复");
            } else if (choice == 3) {
                System.out.println("开谁？");
                String no = in.next();
                boolean b = c.fire(no);
                System.out.println(b);
            } else if (choice == 4) {
                Staff staff = c.getTopSalary();
                if (staff == null) {
                    System.out.println("没人");
                } else {
                    System.out.println(staff + "薪水最高");
                }
            } else if (choice == 9) {
                break;
            }
            System.out.println("任意键返回");
            in.next();//任意键返回
        }
    }
}
